<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'manageClass.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<LINK href="<%=basePath%>/css/main.css" type="text/css" rel="stylesheet">

<script type="text/javascript">

function updateNews(id){
	window.location="DynamicNewsServlet?action=edit&newsID="+id;	
}

function check(){
	if(document.getElementById("allcheck").checked){
		var list = document.getElementsByName("checkb");
		for(var i=0;i<list.length;i++){
			list[i].checked="checked";
		}

	}else{
		
		var list = document.getElementsByName("checkb");
		for(var i=0;i<list.length;i++){
			list[i].checked="";
		}
	}
}	

function deleteAll(){
	if(window.confirm("确定删除？")){
		var list = document.getElementsByName("checkb");
		var arr = new Array();
		for(var i=0,j=0;i<list.length;i++){
			if(list[i].checked){
				arr[j]=list[i].value;
				j++;
			}
		}
		window.location="DynamicNewsServlet?action=delAllSelect&uidList="+arr;
		alert("删除成功！");
	}	
}

function del(id){
	if(window.confirm("确定删除？")){
		window.location="DynamicNewsServlet?action=del&newsID="+id;
		alert("删除成功！");
	}	
}


  </script>
</head>

<body>
<TABLE class=small cellSpacing=0 cellPadding=3 width="100%" border=0>
	<TBODY>
		<TR>
			<TD class=Big><IMG src="<%=basePath%>/img/office/address.gif"
				align=absMiddle><SPAN class=big3>&nbsp; 最新动态管理 </SPAN></TD>
		</TR>
	</TBODY>
</TABLE>

<table class="TableBlock" width="750" align="center">
	<tr align="center">
		<td class="showBig"><a>选择</a></td>
		<td class="showBig" width="280"><b>标题</b></td>
		<td class="showBig" width="150"><b>发布时间</b></td>
		<td class="showBig" width="120"><b>操作</b></td>
	</tr>

	<c:forEach items="${newsList}" var="list">
		<tr>
			<td class="TableData" align="center"><input type="checkbox"
				name="checkb" value="${list.dynamicNewsID }" /></td>
			<td class="TableData"><a
				href="DynamicNewsServlet?action=display&newsID=${list.dynamicNewsID }">${list.dynamicNewsTitle
			}</a></td>
			<td class="TableData" align="center">${list.publishTime }</td>
			<td class="TableData" align="center"><input type="button"
				value="修改" class="SmallButton"
				onclick='updateNews(${list.dynamicNewsID});' />&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="button" class="SmallButton"
				onclick="del(${list.dynamicNewsID })" value="删除" /></td>



		</tr>

	</c:forEach>




	<tr>
		<td class="TableData" align="center" width="50"><input
			type="checkbox" name="allcheck" onclick="check()" />全选</td>
		<td colspan="2" class="TableData">共 1 页 <a href="">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;<a
			href="">下一页</a></td>

		<td class="TableData"><input type="button" onclick="deleteAll()"
			class="SmallButton" value="删除选中的" /></td>
	</tr>



</table>

</body>



</html>
